/**
 * rand0.c - 生成随机数
 * 使用ANSI C 可移植算法
 */
#include <time.h>
static unsigned long int next = 1; /* 种子 */

unsigned int rand0(void)
{
    /* 生成伪随机数的魔术公式*/
    next = next * 1103515245 + 12345;
    return (unsigned int) (next / 65536) % 32768;
}

unsigned int rand1(void)
{
    /* 生成伪随机数的魔术公式*/
    next = next * 1103515245 + 12345;
    return (unsigned int) (next / 65536) % 32768;
}

int srand1(unsigned int seed)
{
    next = seed;
}
